package vno.fux.res.manager
{
	import flash.events.EventDispatcher;
	import vno.fux.res.pool.ResourcePool;
	import vno.fux.res.pool.RM_SRM;
	import vno.fux.res.pool.Resource;
	import vno.fux.GlobalVar;
	internal class SoundResourceManager extends EventDispatcher
	{
		public static var instance:SoundResourceManager;
		private const obj_id:String = "RM_SRM";
		private var _resourcePool:ResourcePool;
		private var _loaderManager:LoaderManager;
		private var _resInfo:XML;
		public function SoundResourceManager(pvt:PrivateClass, resInfo_:XML)
		{
			_resourcePool = ResourcePool.getInstance();
			_loaderManager = ResourceManager.loader;
			_resInfo = resInfo_;
		}
		public function load(id:uint):void
		{
			use namespace RM_SRM;
			//trace(getQualifiedClassName(_chaResInfo..res.(@id==id)[0]));
			for each(var res:XML in _resInfo.assets.(@id==id)[0].elements())
			{
				var url:String = res.@url;
				var sndRes:Resource = _resourcePool.sndRes.getRes(id);
				var mission:ResourceMission = new ResourceMission(GlobalVar.webUrl+url, sndRes["_"+res.name()], CommonLoader.SOUND, sndRes, _loaderManager.getId());
				_loaderManager.addMission(mission);
			}
		}
		public static function init(resInfo_:XML):void
		{
			if(SoundResourceManager.instance)
			{
				throw new Error("You can't init the SoundResourceManager twice!")
			}
			SoundResourceManager.instance = new SoundResourceManager(new PrivateClass, resInfo_);
		}
		public static function getInstance():SoundResourceManager
		{
			return SoundResourceManager.instance;
		}
	}
}
class PrivateClass
{
	public function PrivateClass()
	{
	}
}